![]() |
Manipulate Windows? | ||||||||
A main use for JavaScript is to manipulate
windows and frames to make your site more easy to navigate through and so forth. A window
object can be handled by a JavaScript object called window ,
wherreas a document object can always be opened by a JavaScript object called document . This part of our tutorial will get you more
familar with JavaScript capabilities with windows and frames. Obviously, you know a browser can open more than one window at once. Each window
is represented by a Window object in JavaScript. Using JavaScript, you can have full
control of opening new windows. The simplest way to open a new window is using
Then call it in your HTML document like so:
By using a # in the tag, you prevent a page from being replaced when a link is followed. Now you can open more than 1 window at a time and specify the size of the window your opening.
This will open 2 windows; one window smaller then the other. This is quite simple and can be done for any amount of windows. The
This is usually a bad for 2 major reasons. When the function ends and the variable goes, you loose track of the new window. It is better to keep the variable permanent, incase you want to use it again. Also, people do NOT appreciate unexpected windows popping up all over (ie Geocities, Tripod). |
|||||||||
Just place this between the head tag in the page and your set! |
|||||||||